package com.ftg.mall.service.impl.pms;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ftg.mall.base.entity.pms.SkuStock;
import com.ftg.mall.base.util.tooltips.ResBean;
import com.ftg.mall.mapper.pms.ProductFullReductionMapper;
import com.ftg.mall.mapper.pms.SkuStockMapper;
import com.ftg.mall.service.pms.ISkuStockService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * sku的库存 服务实现类
 * </p>
 *
 * @author wangty
 * @since 2022-11-17
 */
@Service
public class SkuStockServiceImpl extends ServiceImpl<SkuStockMapper, SkuStock> implements ISkuStockService {

    @Resource
    SkuStockMapper skuStockMapper;


    @Override
    public List<SkuStock> insertSku(SkuStock skuStock,Long productId) {

        if (skuStock.getStock().equals(skuStock.getLowStock())){
            throw new RuntimeException("库存不多了，请及时添加库存");
        }
        return skuStockMapper.insertSku(skuStock,productId);
    }
}
